package com.grace.law.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.grace.law.bean.Case;
import com.grace.law.bean.CaseExample;
import com.grace.law.bean.CaseRemark;
import com.grace.law.dao.CaseMapper;
import com.grace.law.dao.CaseRemarkMapper;

@Service
public class CaseService {
	@Autowired
	CaseMapper mapper;
	@Autowired
	CaseRemarkMapper remarkMapper;
	
	public void insert(Case record){
		mapper.insertSelective(record);
	}
	
	public int insert(CaseRemark record){
		return remarkMapper.insertSelective(record);
	}
	
	public List<Case> getAll(CaseExample caseExample) {
		return mapper.selectByExample(caseExample);
	}

	public Case selectCaseById(String customerId) {
		Case caseobj =mapper.selectByPrimaryKey(Integer.valueOf(customerId));
		return caseobj;
	}
	
	public int save(Case record){
		return	mapper.updateByPrimaryKey(record);
	}

	public List<CaseRemark> getRemarkByCustomerId(Integer customerId) {

		return remarkMapper.selectByCustomerId(customerId);

	}
	
	public CaseRemark getRemark(Integer rid){
		return remarkMapper.selectByPrimaryKey(rid);
	}
	
	public int save(CaseRemark record){
		return	remarkMapper.updateByPrimaryKeySelective(record);
	}
}
